import json
json_data = '[{"name":"汤","age":18},{"name":"root","age":16},{"name":"alis","age":20}]'
json_data2 = '{"name":"汤","age":18}'
python_data = [{"name":"汤","age":18},{"name":"root","age":16},{"name":"alis","age":20}]
python_data2 = {"name":"汤","age":18}

data= json.dumps(python_data,ensure_ascii=False)
print(f"数据类型为:{type(data)}\npython转json后内容为:{data}")
data= json.dumps(python_data2,ensure_ascii=False)
print(f"数据类型为:{type(data)}\npython转json后内容为:{data}")

data= json.loads(json_data)
print(f"数据类型为:{type(data)}\njson转python后内容为:{data}")
data= json.loads(json_data2)
print(f"数据类型为:{type(data)}\njson转python后内容为:{data}")
